import React, { Component } from 'react';
import {
    View,
    Text,
    TouchableWithoutFeedback
} from 'react-native';


export default class TabItem extends Component {

    constructor(props) {
        super(props);
        this.state = {
            
        };
    }
    
    render() {
        const {styles, data, curIdx,onTabClick} = this.props;
        return (
            <TouchableWithoutFeedback onPress={()=>onTabClick(data)}>
                <View style={[styles.tabItem,data.field === curIdx && styles.tabItemCurrent]}>
                    <Text style={[styles.tabItemText,data.field === curIdx && styles.tabItemTextCurrent]}>{data.field_name}</Text>
                </View>
            </TouchableWithoutFeedback>
        );
    }
    
}